package com.example.simple

import android.app.Application

import com.orhanobut.logger.AndroidLogAdapter
import com.orhanobut.logger.DiskLogAdapter
import com.orhanobut.logger.FormatStrategy
import com.orhanobut.logger.Logger
import com.orhanobut.logger.PrettyFormatStrategy
import com.xxf.basemvp.BuildConfig

class App : Application() {

    override fun onCreate() {
        super.onCreate()
        initLogger()
    }


    //初始化Logger
    private fun initLogger() {
        val formatStrategy = PrettyFormatStrategy.newBuilder()
                .showThreadInfo(false)
                .tag("xxf -taf")
                .build()
        val adapter = object : AndroidLogAdapter(formatStrategy) {
            override fun isLoggable(priority: Int, tag: String?): Boolean {
                return BuildConfig.DEBUG
            }
        }
        Logger.addLogAdapter(adapter)
    }
}
